package com.woniuxy.intellihome.service.impl;

import com.woniuxy.intellihome.entity.Address;
import com.woniuxy.intellihome.mapper.AddressMapper;
import com.woniuxy.intellihome.service.AddressService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2021-08-11
 */
@Service
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements AddressService {
    @Autowired
    private AddressMapper addressMapper;

    @Override
    public List<Address> getByUserId(int user_id) {
        return addressMapper.getByUserId(user_id);
    }

    @Override
    public Address getDefault(int user_id, String isdefault) {
        return addressMapper.getDefault(user_id, isdefault);
    }

    @Override
    public void add(Address address) {
        addressMapper.insert(address);
    }

    @Override
    public int getAddressNumsByUser_id(int user_id) {
        return addressMapper.getAddressNumsByUser_id(user_id);
    }


}
